<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Storage References (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Storage References (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Storage References (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Expression-trees.html" rel="up" title="Expression trees">
<link href="Unary-and-Binary-Expressions.html" rel="next" title="Unary and Binary Expressions">
<link href="Constant-expressions.html" rel="prev" title="Constant expressions">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<span id="Storage-References"></span><div class="header">
<p>
Next: <a href="Unary-and-Binary-Expressions.html" accesskey="n" rel="next">Unary and Binary Expressions</a>, Previous: <a href="Constant-expressions.html" accesskey="p" rel="prev">Constant expressions</a>, Up: <a href="Expression-trees.html" accesskey="u" rel="up">Expression trees</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="References-to-storage"></span><h4 class="subsection">11.6.2 References to storage</h4>
<span id="index-ADDR_005fEXPR"></span>
<span id="index-INDIRECT_005fREF"></span>
<span id="index-MEM_005fREF"></span>
<span id="index-ARRAY_005fREF"></span>
<span id="index-ARRAY_005fRANGE_005fREF"></span>
<span id="index-TARGET_005fMEM_005fREF"></span>
<span id="index-COMPONENT_005fREF"></span>

<dl compact="compact">
<dt><code>ARRAY_REF</code></dt>
<dd><p>These nodes represent array accesses.  The first operand is the array;
the second is the index.  To calculate the address of the memory
accessed, you must scale the index by the size of the type of the array
elements.  The type of these expressions must be the type of a component of
the array.  The third and fourth operands are used after gimplification
to represent the lower bound and component size but should not be used
directly; call <code>array_ref_low_bound</code> and <code>array_ref_element_size</code>
instead.
</p>
</dd>
<dt><code>ARRAY_RANGE_REF</code></dt>
<dd><p>These nodes represent access to a range (or &ldquo;slice&rdquo;) of an array.  The
operands are the same as that for <code>ARRAY_REF</code> and have the same
meanings.  The type of these expressions must be an array whose component
type is the same as that of the first operand.  The range of that array
type determines the amount of data these expressions access.
</p>
</dd>
<dt><code>COMPONENT_REF</code></dt>
<dd><p>These nodes represent non-static data member accesses.  The first
operand is the object (rather than a pointer to it); the second operand
is the <code>FIELD_DECL</code> for the data member.  The third operand represents
the byte offset of the field, but should not be used directly; call
<code>component_ref_field_offset</code> instead.
</p>
</dd>
<dt><code>ADDR_EXPR</code></dt>
<dd><p>These nodes are used to represent the address of an object.  (These
expressions will always have pointer or reference type.)  The operand may
be another expression, or it may be a declaration.
</p>
<p>As an extension, GCC allows users to take the address of a label.  In
this case, the operand of the <code>ADDR_EXPR</code> will be a
<code>LABEL_DECL</code>.  The type of such an expression is <code>void*</code>.
</p>
<p>If the object addressed is not an lvalue, a temporary is created, and
the address of the temporary is used.
</p>
</dd>
<dt><code>INDIRECT_REF</code></dt>
<dd><p>These nodes are used to represent the object pointed to by a pointer.
The operand is the pointer being dereferenced; it will always have
pointer or reference type.
</p>
</dd>
<dt><code>MEM_REF</code></dt>
<dd><p>These nodes are used to represent the object pointed to by a pointer
offset by a constant.
The first operand is the pointer being dereferenced; it will always have
pointer or reference type.  The second operand is a pointer constant
serving as constant offset applied to the pointer being dereferenced
with its type specifying the type to be used for type-based alias analysis.
The type of the node specifies the alignment of the access.
</p>
</dd>
<dt><code>TARGET_MEM_REF</code></dt>
<dd><p>These nodes represent memory accesses whose address directly map to
an addressing mode of the target architecture.  The first argument
is <code>TMR_BASE</code> and is a pointer to the object being accessed.
The second argument is <code>TMR_OFFSET</code> which is a pointer constant
with dual purpose serving both as constant offset and holder of
the type used for type-based alias analysis.  The first two operands
have exactly the same semantics as <code>MEM_REF</code>.  The third
and fourth operand are <code>TMR_INDEX</code> and <code>TMR_STEP</code> where
the former is an integer and the latter an integer constant.  The
fifth and last operand is <code>TMR_INDEX2</code> which is an alternate
non-constant offset.  Any of the third to last operands may be
<code>NULL</code> if the corresponding component does not appear in
the address, but <code>TMR_INDEX</code> and <code>TMR_STEP</code> shall be
always supplied in pair.  The Address of the <code>TARGET_MEM_REF</code>
is determined in the following way.
</p>
<div class="example">
<pre class="example">TMR_BASE + TMR_OFFSET + TMR_INDEX * TMR_STEP + TMR_INDEX2
</pre></div>

<p>The type of the node specifies the alignment of the access.
</p>
</dd>
</dl>

<hr>
<div class="header">
<p>
Next: <a href="Unary-and-Binary-Expressions.html" accesskey="n" rel="next">Unary and Binary Expressions</a>, Previous: <a href="Constant-expressions.html" accesskey="p" rel="prev">Constant expressions</a>, Up: <a href="Expression-trees.html" accesskey="u" rel="up">Expression trees</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
